﻿using AutoMapper;
using Niti.OrderManage.DTO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.AutoMapper;
using Niti.OrderManage.OrderManage;

namespace Niti.OrderManage
{
   public class NitiAutoMapperProfile: Profile
    {
        public NitiAutoMapperProfile()
        {
            CreateMap<Supplier, AddSupplierDto>()
                .ForMember(x => x.Code, opt => opt.MapFrom(input => input.Code))
                .ForMember(x => x.SName, opt => opt.MapFrom(input => input.SName))
                .ForMember(x => x.BeginTime, opt => opt.MapFrom(input => input.BeginTime))
                .ForMember(x => x.EndTime, opt => opt.MapFrom(input => input.EndTime))
                .ForMember(x => x.ContactName, opt => opt.MapFrom(input => input.ContactName))
                .ForMember(x => x.ContactNumber, opt => opt.MapFrom(input => input.ContactNumber));

            CreateMap<AddSupplierDto, Supplier>()
                .ForMember(x => x.Code, opt => opt.MapFrom(input => input.Code))
                .ForMember(x => x.SName, opt => opt.MapFrom(input => input.SName))
                .ForMember(x => x.BeginTime, opt => opt.MapFrom(input => input.BeginTime))
                .ForMember(x => x.EndTime, opt => opt.MapFrom(input => input.EndTime))
                .ForMember(x => x.ContactName, opt => opt.MapFrom(input => input.ContactName))
                .ForMember(x => x.ContactNumber, opt => opt.MapFrom(input => input.ContactNumber))
                .ForMember(x => x.Id, opt => opt.Ignore())
                .ForMember(x => x.IsDeleted, map => map.Ignore())
                .ForMember(x => x.CreationTime, map => map.Ignore())
                .ForMember(x => x.UpdateTime, map => map.Ignore())
                .ForMember(x => x.DeleteTime, map => map.Ignore());

        }
    }
}
